﻿<!--
 Copyright (c) 2012 Nokia Corporation.
 -->

<phone:PhoneApplicationPage 
    x:Class="SurveillanceCamera.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:src="clr-namespace:SurveillanceCamera.UserControls"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.Background>
            <ImageBrush ImageSource="/SurveillanceCamera;component/Images/page_background.jpg" />
        </Grid.Background>


        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Surveillance Camera" Style="{StaticResource PhoneTextNormalStyle}"/>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="PageTitle" Grid.Row="0" Grid.Column="0" Text="monitoring" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
                <Image x:Name="isMonitoringImage" Grid.Row="0" Grid.Column="1" Width="40" Height="40" Source="/Images/Stop.png" />
            </Grid>
        </StackPanel>

        <StackPanel Grid.Row="1" Margin="0,0,0,0">

            <!-- Custom User Control for showing camera viewfinder -->
            <src:CameraViewfinder x:Name="CameraViewfinder" Width="350" Height="250" Margin="0,0,0,0" />
            <Image Source="/Images/wp_viewfinder_glow.png"/>

            <!-- Slider for showing camera activity -->
            <TextBlock Margin="25,-30,0,0" Text="Movement in viewfinder" Style="{StaticResource PhoneTextNormalStyle}"/>
            <Slider Margin="10,0,10,0" Orientation="Horizontal" 
                    Name="ActivitySlider" Value="{Binding Activity, Mode=TwoWay}" Minimum="0" Maximum="50" 
                    IsHitTestVisible="False" ValueChanged="ActivitySlider_ValueChanged" />

            <!-- Slider for setting treshold for camera -->
            <TextBlock Margin="25,-20,0,0" Text="Sensitivity" Style="{StaticResource PhoneTextNormalStyle}"/>
            <Slider Margin="10,0,10,0" Orientation="Horizontal" 
                    Name="CameraTresholdSlider" Value="{Binding Treshold, Mode=TwoWay}" Minimum="0" Maximum="10" ValueChanged="CameraTresholdSlider_ValueChanged" />

            <!-- Start / Stop monitoring button -->
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button x:Name="StartBtn" Content="Start monitoring" Width="240" IsEnabled="True" Click="StartBtn_Click" />
                <Button x:Name="StopBtn" Content="Stop" Width="240" Click="StopBtn_Click" IsEnabled="False" />
            </StackPanel>
            
        </StackPanel>
        
    </Grid>


   <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.questionmark.rest.png" Text="About" Click="ApplicationBarMenuItem_Click" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="ovi account" Click="ApplicationBarMenuItem_Click_3" />
                <shell:ApplicationBarMenuItem Text="show log" Click="ApplicationBarMenuItem_Click_2" />
                <shell:ApplicationBarMenuItem Text="clear log" Click="ApplicationBarMenuItem_Click_1" />
                <shell:ApplicationBarMenuItem Text="about" Click="ApplicationBarMenuItem_Click" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>


</phone:PhoneApplicationPage>